function serviceHeader() {
  return new ServiceHeader(
    26,
    "youdao",
    "\u6709\u9053\u7ffb\u8bd1\u63d0\u4f9b\u5373\u65f6\u514d\u8d39\u7684\u4e2d\u3001\u82f1\u3001\u65e5\u3001\u97e9\u3001\u6cd5\u3001\u4fc4\u3001\u897f\u73ed\u7259\u6587\u5168\u6587\u7ffb\u8bd1\u3001\u7f51\u9875\u7ffb\u8bd1\u670d\u52a1\u3002" +
      Const.NL2 +
      "https://fanyi.youdao.com/" +
      Const.NL2 +
      "\u00a9 2022 \u7f51\u6613\u516c\u53f8 \u4eacICP\u8bc1080268\u53f7",
    Capability.TRANSLATE | Capability.DICTIONARY
  );
}
function serviceHost(a, b, d) {
  return a == Capability.TRANSLATE ? "fanyi.youdao.com" : "dict.youdao.com";
}
function serviceLink(a, b, d, e) {
  return "https://" + (e ? "dict.youdao.com" : "fanyi.youdao.com");
}
SupportedLanguages = [
  -1,
  "AUTO",
  -1,
  -1,
  -1,
  "ar",
  -1,
  -1,
  -1,
  -1,
  -1,
  "zh-CHS",
  "zh-CHS",
  -1,
  -1,
  -1,
  -1,
  "en",
  -1,
  -1,
  -1,
  "fr",
  -1,
  "de",
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  "id",
  "it",
  -1,
  "ja",
  -1,
  "ko",
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  "pt",
  -1,
  "ru",
  -1,
  -1,
  -1,
  "es",
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  "vi",
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
  -1,
];
function serviceTranslateRequest(a, b, d) {
  a = prepareSource(a);
  a = limitSource(a);
  var e = "" + new Date().getTime() + parseInt(10 * Math.random(), 10),
    c = Utils.md5("fanyideskweb" + a + e + "Y2FYu%TNSbMCxc3t2u^XT");
  a = format(
    "i={0}&from={1}&to={2}&smartresult=dict&client={3}&salt={4}&sign={5}&doctype=json&version=2.1&keyfrom=fanyi.web",
    encodeURIComponent(a),
    codeFromLanguage(b),
    codeFromLanguage(d),
    "fanyideskweb",
    e,
    c
  );
  b =
    getHeader() +
    Const.NL +
    "Referer: " +
    serviceLink() +
    Const.NL +
    // "Cookie: OUTFOX_SEARCH_USER_ID=1@100.1.1.1;";
    "Cookie: OUTFOX_SEARCH_USER_ID=1597342604@10.108.160.137";
  return new RequestData(
    HttpMethod.POST,
    "/translate?smartresult=dict&smartresult=rule",
    a,
    b
  );
}
function serviceTranslateResponse(a, b, d, e) {
  b = parseJSON(b);
  a = "";
  var c;
  if (b && b.translateResult) {
    for (c = 0; c < b.translateResult.length; c++) {
      for (var f = b.translateResult[c], g = 0; g < f.length; g++)
        a += f[g].tgt;
      a += Const.NL;
    }
    if (b.smartResult)
      for (f = b.smartResult.entries, c = 0; c < f.length; c++)
        (a += f[c]), (a += Const.NL);
    b.type &&
      ((b = b.type),
      (c = b.indexOf("2")),
      -1 < c &&
        ((d = languageFromCode(b.slice(0, c))),
        (e = languageFromCode(b.slice(c + 1)))));
  }
  return new ResponseData(a, d, e);
}
function serviceDictionaryRequest(a, b, d) {
  a = buildUri(a, b, d);
  return new RequestData(HttpMethod.GET, a);
}
function serviceDictionaryResponse(a, b, d, e) {
  b = stringFindSub(
    b,
    '<div id="results-contents" class="results-content">',
    !1,
    '<div id="ads"',
    !1
  );
  b = removeAttributes(
    '<div><style>p.via,span.via{color: #959595}.trans-wrapper h3{font-size:130%;border-bottom:2px solid #ddd}.clearfix:after{content:".";display:block;height:0;visibility:hidden;clear:both}.clearfix{zoom:1}.img-list{float:right}.img-list img{height:80px;padding:2px;border:1px solid #e5e5e5}.keyword{margin-right:1px;vertical-align:bottom;margin-right:15px}.baav{margin-top:3px}.pronounce{margin-right:30px;color:#666;display:inline-block;line-height:26px}.pronounce .phonetic{margin-left:.2em}.phonetic,.field,.origin,.complexfont{font-weight:normal;color:#666;margin:0 .1em}.gray{color:#a0a0a0}.collinsMajorTrans{background:#eff5f8;padding:5px 5px 5px 25px;width:525px}.additional{color:#959595}.trans-container .ol li{list-style-type:decimal;list-style-position:inside;margin:0 0 .7em 0}.trans-container p,.trans-container li {line-height: 24px}</style><div>' +
      b,
    ["id", "name", "onmouseover", "onmouseout", "onmousedown"]
  );
  var c = serviceHost(Capability.DICTIONARY, d, e);
  a = buildUri(a, d, e);
  a = "https://" + c + a;
  b = updateHtmlLinks(b, c);
  return new ResponseData(b, d, e, a);
}
function buildUri(a, b, d) {
  return format("/w/{0}/", encodeGetParam(a));
}
